package com.cv.platform.dal.es.index.video;

import com.cv.platform.framework.es.core.EsLocalDateTimeConverter;
import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.ValueConverter;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 视频搜索引擎实体类
 *
 * @author Charles_XDXD
 */

@Data
@Builder
@Document(indexName = "cv_video_entity")
public class CvVideoEntity {

    @Id
    private Long id;

    /**
     * 用户编号
     */
    @Field(type = FieldType.Long)
    private Long userId;

    /**
     * 用户昵称
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String nickname;

    /**
     * 视频标题
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String title;

    /**
     * 视频类型
     */
    @Field(type = FieldType.Keyword)
    private String type;

    /**
     * 视频标签
     */
    @Field(type = FieldType.Keyword)
    private List<String> labels;

    /**
     * 视频播放量
     */
    @Field(type = FieldType.Integer)
    private Integer viewCount;

    /**
     * 视频封面
     */
    @Field(type = FieldType.Long)
    private Long thumbnail;

    /**
     * 发布时间
     */
    @Field(type = FieldType.Date)
    @ValueConverter(EsLocalDateTimeConverter.class)
    private LocalDateTime publishTime;

}
